package bjut.core.util;

/**
 * @Author: zhuzhiming
 * @Date: 2022/4/3 0:15
 */
public class ClassUtil {

    public static ClassLoader getDefaultClassLoader() {

        ClassLoader classLoader = null;

        try {
            classLoader = Thread.currentThread().getContextClassLoader();
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (classLoader == null) {
            classLoader = ClassUtil.class.getClassLoader();
        }

        return classLoader;

    }

    public static boolean isCglibProxyClass(Class<?> clazz) {
        return (clazz != null && isCglibProxyClassName(clazz.getName()));
    }

    private static boolean isCglibProxyClassName(String clazzName) {
        return clazzName != null && clazzName.contains("$$");
    }

}
